home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / osr5 / net / Count-2.4 / cntl / ccs
Text File  |  1998-07-19  |  1KB  |  60 lines

  1. #!/bin/sh
  2. #
  3. # Postinstallscript written by Ron Record (rr@sco.com)
  4. # Just need to setup the Count configuration
  5. # file with the right hostname and IP. 
  6.  
  7. scriptname="$0"
  8. step="$1"
  9. keywords="$2"
  10. pkglist="$3"
  11.  
  12. # Source in the standard functions library, ccsSetup.sh
  13. . ccsSetup.sh
  14.  
  15. #############################################################################
  16. #
  17. #         fixup the IP, NODE and HOST name in any configuration files
  18. #
  19. #############################################################################
  20. doPostExport()
  21. {
  22.   HOSTPROG=/usr/bin/hostname
  23.   HOST_FILES="/usr/local/etc/Counter/conf/count.cfg"
  24.   if [ -x $HOSTPROG ] 
  25.   then
  26.     HOSTNAME=`$HOSTPROG`
  27.   else
  28.     HOSTNAME=localhost
  29.   fi
  30.   [ "$HOSTNAME" ] || HOSTNAME=localhost
  31.   NODENAME=`uname -n`
  32.   [ "$NODENAME" ] || NODENAME=localhost
  33.   IP=`netstat -i -n | grep net0 | awk ' { print $4 } '`
  34.   [ "$IP" ] || IP=127.0.0.1
  35.   for i in $HOST_FILES
  36.   do
  37.   [ -f $i ] && {
  38.     sed -e "s/132.147.49.40/$IP/g" -e "s/disco.pdev.sco.com/$HOSTNAME/g" < $i > /tmp/_ccs$$
  39.     mv /tmp/_ccs$$ $i
  40.     rm -f /tmp/_ccs$$
  41.   }
  42.   [ -f $i ] && {
  43.     sed -e "s/disco/$NODENAME/g" < $i > /tmp/_ccs$$
  44.     mv /tmp/_ccs$$ $i
  45.     rm -f /tmp/_ccs$$
  46.     chown root:sys $i
  47.   }
  48.   done
  49. }
  50.  
  51. ccs_return_value=0
  52.  
  53. case "$step" in
  54.         POST_EXPORT) doPostExport ;;
  55. esac
  56.  
  57. exit $ccs_return_value
  58.  
  59.